package com.gdzn.netty.api.factory;

import com.gdzn.common.core.domain.R;
import com.gdzn.netty.api.service.RemotePrepareOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;


/**
 * 日志服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemotePrepareOrderFallbackFactory implements FallbackFactory<RemotePrepareOrderService>
{
    private static final Logger log = LoggerFactory.getLogger(RemotePrepareOrderFallbackFactory.class);

    @Override
    public RemotePrepareOrderService create(Throwable throwable)
    {
        log.error("报文数据准备生成话单失败:{}", throwable.getMessage());
        return new RemotePrepareOrderService()
        {
            @Override
            public R<Boolean> add(String msgData) {
                return R.fail("生成话单失败:" + throwable.getMessage());
            }

        };

    }
}
